package com.my.testerbaoshenprovider.demo;

import com.alibaba.fastjson.JSON;
import com.lingtianyu.erbaoshen.test.demo.DemoService;
import com.lingtianyu.erbaoshen.test.demo.model.TestReq;
import com.lingtianyu.erbaoshen.test.demo.model.TestResp;
import com.lingtianyu.tech.erbaoshen.core.provider.bean.annotation.ErBaoShenService;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@ErBaoShenService(interfaceClass = DemoService.class)
public class DemoServiceImpl implements DemoService {
    @Override
    public void test1() {
        System.out.println("-------------test1-----------");
    }

    @Override
    public void test2(TestReq req) {
        System.out.println("-------------test2-----------" + JSON.toJSONString(req));
    }

    @Override
    public TestResp test3(TestReq req) {
        System.out.println("-------------test3-----------" + JSON.toJSONString(req));
        TestResp testResp = new TestResp();
        testResp.setL(1l);
        testResp.setI(12);
        testResp.setS("aaa");
        testResp.setDate(new Date());
        testResp.setF(1f);
        testResp.setD(1.1);
        testResp.setBigDecimal(new BigDecimal("1.8"));
        testResp.setResp2(new TestResp.Resp2());
        return testResp;
    }

    @Override
    public List<TestResp> test4(TestReq req) {
        System.out.println("-------------test4-----------" + JSON.toJSONString(req));
        TestResp testResp = new TestResp();
        testResp.setL(1l);
        testResp.setI(12);
        testResp.setS("aaa");
        testResp.setDate(new Date());
        testResp.setF(1f);
        testResp.setD(1.1);
        testResp.setBigDecimal(new BigDecimal("1.8"));
        testResp.setResp2(new TestResp.Resp2());
        List<TestResp> list = new ArrayList<>();
        list.add(testResp);
        return list;
    }

    @Override
    public TestResp[] test5(Integer i, Boolean b, Long l, Float f, Double d, Date date, Short sho, Byte by, String s, Character character) {
        TestResp testResp = new TestResp();
        testResp.setL(1L);
        testResp.setI(12);
        testResp.setS("aaa");
        testResp.setDate(new Date());
        testResp.setF(1f);
        testResp.setD(1.1);
        testResp.setBigDecimal(new BigDecimal("1.8"));
        testResp.setResp2(new TestResp.Resp2());
        TestResp[] ts = new TestResp[1];
        ts[0] = testResp;
        return ts;
    }
}
